package com.imooc.controller;

import com.imooc.grace.result.GraceJSONResult;
import com.imooc.pojo.Teacher;
import com.imooc.service.TeacherService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("teac")
public class HelloController {

    @Autowired
    private TeacherService teacherService;

    @GetMapping("hello")
    public Object hello() {
        return "Hello Teacher~";
    }

    @GetMapping("queryTeacher")
    public GraceJSONResult queryTeacher() {
        Teacher t = teacherService.queryTeacher(1001);
        return GraceJSONResult.ok(t);
    }
}
